Skip to content

mxservicectl: Accept service unit name in mxstartups #4

Merged
merged 1 commit into from
Apr 12, 2018

Conversation

donald
Copy link
Contributor

@donald donald commented Apr 12, 2018

Regard the 4th column of /etc/mxstartups as the name of a systemd
service unit if it ends in ".service". In that case, ignore the
username and use systemctl to start/stop that unit.

The idea is to use /etc/mxstartups for services, which we want to run as
a systems service, e.g. to use the features of systemd. Currently there
is an option to use unit files with an encoded hostname but we prefer to
have the information of which hosts starts which service in
/etc/mxstartups.

Regard the 4th column of /etc/mxstartups as the name of a systemd
service unit if it ends in ".service".  In that case, ignore the
username and use systemctl to start/stop that unit.

The idea is to use /etc/mxstartups for services, which we want to run as
a systems service, e.g. to use the features of systemd. Currently there
is an option to use unit files with an encoded hostname but we prefer to
have the information of which hosts starts which service in
/etc/mxstartups.
@donald donald merged commit e89261f into master Apr 12, 2018
@@ -19,7 +19,14 @@ function mxsrv_start_one() {

. ${cfg}

su - ${MX_SRV_USER} -c "${MX_SRV_SCRIPT} start" &
case "${MX_SRV_SCRIPT}" in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not switch on "user" name ...if eq _systemctl (underscore to make clear its special) so you can actually also start other systemd units like mounts and targets and stuff.. ? ;) gruss m. ... ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIMTOWTDI . We discussed, that this way we were no longer able to call out startstop scripts something with .service (which we would never do, but its a nice argument nonetheless). On the other hand, we had the vision that we might start user specific systemd services (systemctl --user) which would be an argument not to use the user field for something else. Of course, in reality we will never do that, even if it worked, which it doesn't.

We discussed the better solution to allow a script with arguments in the script field - possibly indicated by quotes - possibly with some placeholder for the start/stop argument like

tonerlow argh - "systemdctl %ACTION tonerlow-cups.service"

which is a nice coding challenge - especially if you want to support quoted arguments with whitespace, too - but nobody was eager to take it. So we dismissed it with "makes the line to long, which is ugly in vi" as an excuse. :-)

donald added a commit to mariux64/mxtools that referenced this pull request May 1, 2018
Currently we have a service mxstartup-systemd.service (from the
mxstartup bee package) which starts systemd units identified by a
specific filename pattern in /etc/systemd

    mxstartup-HOSTNAME-NAME.service

We decided to get rid of this mechanism and start host specific service
units from /etc/mxstartup instead. The file format of /etc/mxstartup has
been expanded to enable this [1].

The only two units left which use the old mechanism are
mxstartup-cu-baucamhttpd.service and mxstartup-cu-getcams.service which
we are going to convert now.

Import the existing two units files mxstartup-cu-baucamhttpd.service
and mxstartup-cu-getcams.service into the repository.

[1] mariux64/mxstartup#4
donald added a commit that referenced this pull request May 1, 2018
mxstartup-systemd.service starts systemd units identified by a
specific filename pattern in /etc/systemd

    mxstartup-HOSTNAME-NAME.service

We decided to get rid of this mechanism and start host specific service
units from /etc/mxstartup instead. The file format of /etc/mxstartup
has been expanded to enable this in #4.

The last units which used this mechanism have been converted [1].

Remove files supporting the obsoleted mechanism.

[1] mariux64/mxtools@c907786
@donald donald mentioned this pull request May 1, 2018
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants